<div class="container-fluid">
    <div class="block-header">
        <h2>功能管理 > 论坛 > 管理主题</h2>
    </div>
    <div class="row">
        <div class="col-lg-12 col-md-12">
            <div class="card">
                <div class="header">
                    <h2>管理主题</h2>
                </div>
                <div class="body">
                   <div class="table-responsive1">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                      <th>ID</th>
					                  <th>作者</th>
					                  <th>标题</th>
					                  <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php $threads = Wo_GetForumThreads(array('limit'=> 500000)) ?>
                             <?php foreach ($threads as $thread): ?>
                                <tr data-thread-ident="<?php echo $thread['id']; ?>">
                                    <td><?php echo $thread['id']; ?></td>
                                    <td><?php echo $thread['user_data']['username']; ?></td>
                                    <td>
                                      <a href="<?php echo $thread['url']; ?>">
                                        <?php echo $thread['headline']; ?>
                                      </a>
                                    </td>
                                    <td>
                                        <button class="btn main btn-danger delete-thread waves-effect waves-light" id="<?php echo $thread['id']; ?>">
                                            删除
                                        </button>
                                   </td>
                                </tr>
                            <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
<div class="modal fade" id="delete-thread">
   <div class="modal-dialog">
      <div class="modal-content modal-col-red">
         <div class="modal-header">
            <h4 class="modal-title"><i class="fa fa-exclamation-circle"></i> 删除主题</h4>
         </div>
         <div class="modal-body">
            <p>您确定要删除此主题吗？</p>
         </div>
         <div class="modal-footer">
            <button  type="button" onclick="Wo_DelThreadAdmin($('#delete-thread').attr('data-rmd-thread-ident'))" class="btn btn-link">删除</button>
            <button  type="button" class="btn btn-link" data-dismiss="modal">取消</button>
         </div>
      </div>
   </div>
</div>
<script>
$(function () {
  $('table').DataTable();
});
$(document).on('click', ".delete-thread", function(event) {
    $("#delete-thread").attr('data-rmd-thread-ident', $(this).attr('id')).modal('show');
});
function Wo_DelThreadAdmin(id) {
  if (!id) {
    return false;
  } else{
   $("#delete-thread").modal("hide");
    $("[data-thread-ident='" + id + "']").slideUp(function() {
        $(this).remove()
    });
    $.ajax({
        type: "GET",
        url: Wo_Ajax_Requests_File(),
        data: {
            id: id,
            f: 'delete-thread'
        },
        dataType: 'json'
    });
  }
}
</script>